#ifndef EXTENTSTATSALGO_H_
#define EXTENTSTATSALGO_H_

#include "Extent.h"
#include "ExtentStatistics.h"
#include <vector>

//Holding all the Extent Statistics of an extent ex and other information like the total read miss and the current time slice.
class ExtentStatsAlgo
{
	Extent* ex;
	double totalRM;
	bool currentSlice;
	vector <ExtentStatistics*>* stats;


public:
	ExtentStatsAlgo(Extent*);
	virtual ~ExtentStatsAlgo(void);
	void deleteContent();
	void deleteStat();

	//multiply each statistics with g,g^2,g^3 ...
	void multiplyG(double g, int currentTime);

	//multiply totalRM with g
	void multiplyGInfinite(double g);

	//remove the extent statistics of time - timeToDelete -  and recalculate total random read miss
	void removeStatsOfTime(int timeToDelete);

	//Adding Extent Statistic to stats
	void addStat(ExtentStatistics* stat);

	//Adding to totalRM the no. s
	void addTotalRM(double s);

	//Return sum of Random read miss of all the ExtentStatistics in stats
	void calculateTotalRM();

	//Getters
	int getStatSize(){return stats->size(); };
	Extent* getExtent(){ return ex; };
	vector <ExtentStatistics*>* getStats(){ return stats; };
	bool getCurrentSlice(){ return currentSlice; };
	ExtentStatistics* getStat(int time); /* get Extent Statistics of time */

	//Setters
	double getTotalRM(){ return totalRM; };
	void setTotalRM(double t){totalRM=t;};
	void setCurrentSlice(bool b){ currentSlice=b; };
};

#endif

